subroutine comput_flux1
use var
implicit none

    integer m,j,i
    real(8) f(0:gridsx,0:gridsy,4)
    real(8) local_max
    real(8) f_m,f_p,eps,b
    select case(c_case)
    case(9,10,13,14,15,16)           
        eps=1E-40
        call share_space_x
        do j=1,gridsy
            Qx_m(0:gridsx,j,2)=Qx_m(0:gridsx,j,2)*Qx_m(0:gridsx,j,1)!Qx_m(i,j,2)=u_i+1/2*rho_i+1/2
            Qx_m(0:gridsx,j,3)=Qx_m(0:gridsx,j,3)*Qx_m(0:gridsx,j,1)!Qx_m(i,j,3)=v_i+1/2*rho_i+1/2
            select case(c_eos)
            case(1)!理想气体
                Qx_m(0:gridsx,j,4)=Qx_m(0:gridsx,j,4)/(gamma-1.d0)+0.5d0*(Qx_m(0:gridsx,j,2)**2+Qx_m(0:gridsx,j,3)**2)/Qx_m(0:gridsx,j,1)!p/(gamma-1)+0.5rho(u**2+v**2)
            case(2)!b=0.075d0
                b=0.075d0
                Qx_m(0:gridsx,j,4)=Qx_m(0:gridsx,j,4)*(1.d0-b*Qx_m(0:gridsx,j,1))/(gamma-1.d0)+0.5d0*(Qx_m(0:gridsx,j,2)**2+Qx_m(0:gridsx,j,3)**2)/Qx_m(0:gridsx,j,1)!p/(gamma-1)+0.5rho(u**2+v**2)
            endselect
            Qx_p(0:gridsx,j,2)=Qx_p(0:gridsx,j,2)*Qx_p(0:gridsx,j,1)!Qx_m(i,j,2)=u_i+1/2*rho_i+1/2
            Qx_p(0:gridsx,j,3)=Qx_p(0:gridsx,j,3)*Qx_p(0:gridsx,j,1)!Qx_m(i,j,3)=v_i+1/2*rho_i+1/2
            select case(c_eos)
            case(1)!理想气体
                Qx_p(0:gridsx,j,4)=Qx_p(0:gridsx,j,4)/(gamma-1.d0)+0.5d0*(Qx_p(0:gridsx,j,2)**2+Qx_p(0:gridsx,j,3)**2)/Qx_p(0:gridsx,j,1)!p/(gamma-1)+0.5rho(u**2+v**2)
            case(2)!b=0.075d0
                b=0.075d0
                Qx_p(0:gridsx,j,4)=Qx_p(0:gridsx,j,4)*(1.d0-b*Qx_p(0:gridsx,j,1))/(gamma-1.d0)+0.5d0*(Qx_p(0:gridsx,j,2)**2+Qx_p(0:gridsx,j,3)**2)/Qx_p(0:gridsx,j,1)!p/(gamma-1)+0.5rho(u**2+v**2)
            endselect
        enddo 
    case default!non share weight        
        eps=1E-40
        do j=1,gridsy
            call space(gridsx,KRx,c_case,dx,eps,d(:,j), Qx_p(:,j,1), Qx_m(:,j,1))
            call space(gridsx,KRx,c_case,dx,eps,u(:,j), Qx_p(:,j,2), Qx_m(:,j,2))
            call space(gridsx,KRx,c_case,dx,eps,v(:,j), Qx_p(:,j,3), Qx_m(:,j,3))
            call space(gridsx,KRx,c_case,dx,eps,p(:,j), Qx_p(:,j,4), Qx_m(:,j,4))
            Qx_m(0:gridsx,j,2)=Qx_m(0:gridsx,j,2)*Qx_m(0:gridsx,j,1)!Qx_m(i,j,2)=u_i+1/2*rho_i+1/2
            Qx_m(0:gridsx,j,3)=Qx_m(0:gridsx,j,3)*Qx_m(0:gridsx,j,1)!Qx_m(i,j,3)=v_i+1/2*rho_i+1/2
            select case(c_eos)
            case(1)!理想气体
                Qx_m(0:gridsx,j,4)=Qx_m(0:gridsx,j,4)/(gamma-1.d0)+0.5d0*(Qx_m(0:gridsx,j,2)**2+Qx_m(0:gridsx,j,3)**2)/Qx_m(0:gridsx,j,1)!p/(gamma-1)+0.5rho(u**2+v**2)
            case(2)!b=0.075d0
                b=0.075d0
                Qx_m(0:gridsx,j,4)=Qx_m(0:gridsx,j,4)*(1.d0-b*Qx_m(0:gridsx,j,1))/(gamma-1.d0)+0.5d0*(Qx_m(0:gridsx,j,2)**2+Qx_m(0:gridsx,j,3)**2)/Qx_m(0:gridsx,j,1)!p/(gamma-1)+0.5rho(u**2+v**2)
            endselect
            Qx_p(0:gridsx,j,2)=Qx_p(0:gridsx,j,2)*Qx_p(0:gridsx,j,1)!Qx_m(i,j,2)=u_i+1/2*rho_i+1/2
            Qx_p(0:gridsx,j,3)=Qx_p(0:gridsx,j,3)*Qx_p(0:gridsx,j,1)!Qx_m(i,j,3)=v_i+1/2*rho_i+1/2
            select case(c_eos)
            case(1)!理想气体
                Qx_p(0:gridsx,j,4)=Qx_p(0:gridsx,j,4)/(gamma-1.d0)+0.5d0*(Qx_p(0:gridsx,j,2)**2+Qx_p(0:gridsx,j,3)**2)/Qx_p(0:gridsx,j,1)!p/(gamma-1)+0.5rho(u**2+v**2)
            case(2)!b=0.075d0
                b=0.075d0
                Qx_p(0:gridsx,j,4)=Qx_p(0:gridsx,j,4)*(1.d0-b*Qx_p(0:gridsx,j,1))/(gamma-1.d0)+0.5d0*(Qx_p(0:gridsx,j,2)**2+Qx_p(0:gridsx,j,3)**2)/Qx_p(0:gridsx,j,1)!p/(gamma-1)+0.5rho(u**2+v**2)
            endselect
        enddo 
    endselect
    
    
    
    
    !write(*,'(I4,2X,100(ES12.4,1X))') 0,Qx_m(0:gridsx,2,1)
    !call comput_Qx_m    
    !write(*,'(I4,2X,100(ES12.4,1X))') 1,Qx_m(0:gridsx,2,1)
    !call comput_Qx_p
    call L_F_local_x(Qx_m,Qx_p,f)
    do m=1,4
        do i=0,gridsx
            do j=1,gridsy
                flux1(i,j,m)= f(i,j,m)
                !if( Tstep==1 .AND. KRK==2 .AND.m==1) then
                !    write(*,*)i,j,flux1(i,j,1)
                !endif
            enddo                
        enddo  
    enddo
    
    

end subroutine